home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 September / macformat-004.iso / Shareware City / Graphics / VideoToolbox ƒ / VideoToolboxSources / Nan.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-07  |  1.0 KB  |  30 lines  |  [TEXT/KAHL]

  1. /*
  2. Nan.c
  3. This file declares a global constant that represents a double with the value NAN(004).
  4. You access it by using the symbol "Nan", e.g.
  5.     x=Nan;
  6. "Nan" is defined in VideoToolbox.h as *(double *)__NAN.
  7. The virtue of this approach, rather than just computing a NAN, e.g. 0.0/0.0,
  8. is that it's faster. Secondly, at the moment I'm trying to work around a bug
  9. in the THINK C Debugger (versions 6.01 and 7.0) on the PowerBook 170 that
  10. fails when trying to compute 0.0/0.0 while Virtual Memory is enabled.
  11.  
  12. This scheme should work fine as native code on the PowerPC, but an extra
  13. conditional will probably be required for that case.
  14.  
  15. HISTORY:
  16. 5/94    dgp wrote it.
  17. */
  18.  
  19. #if __option(double_8)
  20.     const short __NAN[]={ 0x7FF0, 0x0800, 0x0000, 0x0000 };
  21. #else
  22.     #if !__option(native_fp)
  23.         const short __NAN[]={ 0x7FFF, 0x7FFF, 0x0004, 0x0000, 0x0000, 0x0000 };
  24.     #elif __option(mc68881)
  25.         const short __NAN[]={ 0x7FFF, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000 };
  26.     #else
  27.         const short __NAN[]={ 0x7FFF, 0x0004, 0x0000, 0x0000, 0x0000 };
  28.     #endif
  29. #endif
  30.